<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form onsubmit="return false">
        <div>
            <label for="user">用户名:</label>
            <input name="user" type="text">
            <span class="user_span"></span>
        </div>
        <div>
            <label for="pwd">密&emsp;码:</label>
            <input name="pwd" type="text">
            <span class="pwd_span"></span>
        </div>
        <div>
            <button id="logBtn">注册</button>
            <input type="reset">
        </div>
    </form>
</body>
<script>
    var userInp = document.getElementsByName("user")[0];
    var pwdInp = document.getElementsByName("pwd")[0];
    var logBtn = document.getElementById("logBtn");

    logBtn.onclick = function () {
        var user = userInp.value;
        var pwd = pwdInp.value;
        if (user && pwd) {
            var xhr = new XMLHttpRequest();

            // xhr.open("post", "../php/post.php", true);
            xhr.open("post", "../php/request.php", true);

            xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            xhr.send("user=" + user + "&pwd=" + pwd);

            xhr.onreadystatechange = function () {

                if (xhr.readyState == 4 && xhr.status == 200) {
                    var result = xhr.responseText;
                    console.log(result);

                    // var data = JSON.parse(result);
                    // console.log(data);
                }
            }
        }

    }


    var a = 1;
    //       a   2      3    4
    console.log(a++ * (++a + a++))
    //           1  * ( 3  + 3   )



</script>

</html>